#include <stdio.h>

int divide(int a, int b)
{
	return a/b;
}

int minus(int a,int b)
{
	return (a-b);
}

int multiply(int a,int b)
{
	return a*b;
}

int add(int a, int b)
{
	return (a+b);
}

typedef int (*mathFun)(int,int);

struct operator
{

	char c;
	mathFun f;
};

int main()
{

	struct operator functs[4];

	functs[0].c = '-';
	functs[0].f = &minus;
	
	functs[1].c = '+';
	functs[1].f = &add;
	
	functs[2].c = '*';
	functs[2].f = &multiply;

	functs[3].c = '/';
	functs[3].f = &divide;


	while(1)
	{

		int a,b,i;
		char c;
		
		i  = 0; 
		

		printf("Enter a: \n");
		scanf("%d",&a);

		printf("Enter b: \n");
		scanf("%d",&b);

		printf("Enter the operator: \n");
		scanf("%c",&c);
		scanf("%c",&c);

		while( i < 4)
		{
			if(functs[i].c == c)
			{

				printf("a %c b = %d\n",c,functs[i].f(a,b));
				break;
			}

			i++;

			if(i == 4)
			{
				printf("Unknown operator:%c \n",c);
				
			}
		}

		
	}

	return 0; 
}
